package menu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import org.dyno.visual.swing.layouts.GroupLayout;

import produto.gui.FormCadastroProduto;
import produto.gui.FormTabelaPesqProduto;
import cliente.gui.FormCadastroCliente;
import cliente.gui.TabelaPesquisaCliente;
import fornecedor.gui.FormCadastroFornecedor;
import funcionario.gui.FormCadastroFuncionario;
import funcionario.gui.FormGridFuncionario;

//VS4E -- DO NOT REMOVE THIS LINE!
public class MenuTela extends JFrame {

	private static final long serialVersionUID = 1L;
	private JMenu jMenu0;
	private JMenuBar jMenuBar0;
	private JMenuItem jMenuItem0;
	private JMenuItem jMenuItem1;
	private JMenu jMenu1;
	private JMenuItem jMenuItem3;
	private JMenuItem jMenuItem2;
	private JMenu jMenu2;
	private JMenuItem jMenuItem4;
	private JMenu jMenu3;
	private JMenuItem jMenuItem5;
	private JMenuItem jMenuItem6;
	private static final String PREFERRED_LOOK_AND_FEEL = "javax.swing.plaf.metal.MetalLookAndFeel";
	public MenuTela() {
		initComponents();
	}

	private void initComponents() {
		setTitle("SysLoja - Sistema de Controle de Estoque e Frente de Loja");
		setLayout(new GroupLayout());
		setJMenuBar(getJMenuBar0());
		setSize(735, 415);
	}


	private JMenuItem getJMenuItem6() {
		if (jMenuItem6 == null) {
			jMenuItem6 = new JMenuItem();
			jMenuItem6.setText("Pesquisar");
			jMenuItem6.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					jMenuItem6ActionActionPerformed(event);
				}
			});
		}
		return jMenuItem6;
	}

	private JMenuItem getJMenuItem5() {
		if (jMenuItem5 == null) {
			jMenuItem5 = new JMenuItem();
			jMenuItem5.setText("Pesquisar");
			jMenuItem5.addActionListener(new ActionListener(){
				public void actionPerformed(ActionEvent event){
					jMenuItem5ActionActionPerformed(event);
				}
			});
		}
		return jMenuItem5;
	}

	private JMenu getJMenu3() {
		if (jMenu3 == null) {
			jMenu3 = new JMenu();
			jMenu3.setText("Funcionarios");
			jMenu3.add(getJMenuItem4());
			jMenu3.add(getJMenuItem5());
		}
		return jMenu3;
	}

	private JMenuItem getJMenuItem4() {
		if (jMenuItem4 == null) {
			jMenuItem4 = new JMenuItem();
			jMenuItem4.setText("Cadastrar");
			jMenuItem4.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					jMenuItem4ActionActionPerformed(event);
				}
			});
		}
		return jMenuItem4;
	}

	private JMenu getJMenu2() {
		if (jMenu2 == null) {
			jMenu2 = new JMenu();
			jMenu2.setText("Fornecedores");
			jMenu2.add(getJMenuItem2());
		}
		return jMenu2;
	}

	private JMenuItem getJMenuItem2() {
		if (jMenuItem2 == null) {
			jMenuItem2 = new JMenuItem();
			jMenuItem2.setText("Cadastrar");
			jMenuItem2.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					jMenuItem2ActionActionPerformed(event);
				}
			});
		}
		return jMenuItem2;
	}

	private JMenuItem getJMenuItem3() {
		if (jMenuItem3 == null) {
			jMenuItem3 = new JMenuItem();
			jMenuItem3.setText("Pesquisar");
			jMenuItem3.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					jMenuItem3ActionActionPerformed(event);
				}
			});
		}
		return jMenuItem3;
	}

	private JMenu getJMenu1() {
		if (jMenu1 == null) {
			jMenu1 = new JMenu();
			jMenu1.setText("Produtos");
			jMenu1.setOpaque(false);
			jMenu1.add(getJMenuItem1());
			jMenu1.add(getJMenuItem3());
		}
		return jMenu1;
	}

	private JMenuItem getJMenuItem1() {
		if (jMenuItem1 == null) {
			jMenuItem1 = new JMenuItem();
			jMenuItem1.setText("Cadastrar");
			jMenuItem1.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					jMenuItem1ActionActionPerformed(event);
				}
			});
		}
		return jMenuItem1;
	}

	private JMenuBar getJMenuBar0() {
		if (jMenuBar0 == null) {
			jMenuBar0 = new JMenuBar();
			jMenuBar0.add(getJMenu0());
			jMenuBar0.add(getJMenu1());
			jMenuBar0.add(getJMenu2());
			jMenuBar0.add(getJMenu3());
		}
		return jMenuBar0;
	}

	private JMenu getJMenu0() {
		if (jMenu0 == null) {
			jMenu0 = new JMenu();
			jMenu0.setText("Clientes");
			jMenu0.setOpaque(false);
			jMenu0.add(getJMenuItem0());
			jMenu0.add(getJMenuItem6());
		}
		return jMenu0;
	}

	private JMenuItem getJMenuItem0() {
		if (jMenuItem0 == null) {
			jMenuItem0 = new JMenuItem();
			jMenuItem0.setText("Cadastrar");
			jMenuItem0.addActionListener(new ActionListener() {
	
				public void actionPerformed(ActionEvent event) {
					jMenuItem0ActionActionPerformed(event);
				}
			});
		}
		return jMenuItem0;
	}

	private static void installLnF() {
		try {
			String lnfClassname = PREFERRED_LOOK_AND_FEEL;
			UIManager.setLookAndFeel(lnfClassname);
		} catch (Exception e) {
			System.err.println("Cannot install " + PREFERRED_LOOK_AND_FEEL
					+ " on this platform:" + e.getMessage());
		}
	}

	/**
	 * Main entry of the class.
	 * Note: This class is only created so that you can easily preview the result at runtime.
	 * It is not expected to be managed by the designer.
	 * You can modify it as you like.
	 */
	public static void main(String[] args) {
		installLnF();
		SwingUtilities.invokeLater(new Runnable() {
			@Override
			public void run() {
				MenuTela frame = new MenuTela();
				frame.setDefaultCloseOperation(MenuTela.EXIT_ON_CLOSE);
				frame.setTitle("SysLoja - Sistema de Controle de Estoque e Frente de Loja");
				frame.getContentPane().setPreferredSize(frame.getSize());
				frame.pack();
				frame.setLocationRelativeTo(null);
				frame.setVisible(true);
			}
		});
	}

	private void jMenuItem0ActionActionPerformed(ActionEvent event) {
	
		FormCadastroCliente fc = new FormCadastroCliente();
		fc.setVisible(true);
		
	}

	private void jMenuItem1ActionActionPerformed(ActionEvent event) {
		
		FormCadastroProduto fcp = new FormCadastroProduto();
		fcp.setVisible(true);
		
	}

	private void jMenuItem3ActionActionPerformed(ActionEvent event) {
		
		FormTabelaPesqProduto ftp = new FormTabelaPesqProduto();
		ftp.setVisible(true);
	}

	private void jMenuItem2ActionActionPerformed(ActionEvent event) {
		FormCadastroFornecedor cadForn = new FormCadastroFornecedor();
		cadForn.setVisible(true);
	}

	private void jMenuItem4ActionActionPerformed(ActionEvent event) {
		FormCadastroFuncionario cadFunc = new FormCadastroFuncionario();
		cadFunc.setVisible(true);
	}
	
	private void jMenuItem5ActionActionPerformed(ActionEvent event) {
		FormGridFuncionario gridFunc = new FormGridFuncionario();
		gridFunc.setVisible(true);
	}

	private void jMenuItem6ActionActionPerformed(ActionEvent event) {
		TabelaPesquisaCliente tpc = new TabelaPesquisaCliente();
		tpc.setVisible(true);
	}

}
